import request from '@/utils/request'

export function feachList(data) {
  return request({
    url: '/admin/article/list',
    method: 'post',
    data
  })
}

export function feachImgList() {
  return request({
    url: '/admin/article/fileList',
    method: 'get'
  })
}

export function saveOrUpdate(data) {
  return request({
    url: '/admin/article/saveOrUpdate',
    method: 'post',
    data
  })
}

export function info(id) {
  return request({
    url: `/admin/article/info/${id}`,
    method: 'get'
  })
}

export function del(id) {
  return request({
    url: `/admin/article/del/${id}`,
    method: 'delete'
  })
}

export function uploadFile(data) {
  return request({
    url: '/admin/article/update',
    method: 'post',
    data
  })
}

export function changeStatus(value, id, type) {
  return request({
    url: `/admin/article/changeStatus/${id}`,
    method: 'patch',
    params: {
      type: type,
      value: value
    }
  })
}

export function batchPush(ids) {
  console.info(ids)
  return request({
    url: `/admin/article/push`,
    method: 'post',
    params: {
      ids: ids.join(',')
    }
  })
}
